<template>
      <a-spin :spinning="loading">
  <a-list>
    <a-list-item v-for="(item, index) in list" :key="index">
      <router-link  class="no-focus" :to="{ 
        name: 'prewarningHandle', 
        params: { row: { ...item, type: 'not' } }
       }">
        <a-list-item-meta :title="item.ruleName" :description="item.total">
        </a-list-item-meta>
      </router-link>
    </a-list-item> 
    <div
      v-if="total > 5"
      slot="loadMore"
      :style="{ textAlign: 'center', marginTop: '12px', height: '32px', lineHeight: '32px' }"
    >
      <router-link :to="{ 
        name: 'desktopIndex'
       }">
        查看更多
      </router-link>
    </div>
  </a-list>
  </a-spin>
</template>

<script>
import { getWarningBacklog } from '@/api/monitor'
export default {
  name: 'Warning',
  data () {
    return {
      loading: false,
      total: 0,
      list: []
    }
  },
  methods: {
    async getList() {
      this.list = []
      this.total = 0
      const params = {
        pageNo: 1,
        pageSize: 5
      }
      this.loading = true
      const res = await getWarningBacklog(params)
      this.loading = false
      if (res.data) {
        this.total = res.data.total
        this.list = res.data.records
      }
    }
  }
}
</script>
<style lang="less" scoped>

</style>
